import React, { Component } from 'react';
import PropTypes from 'prop-types'
// import axios from 'axios';
class Xiaojiejie extends Component {
    constructor(props){
        super(props)
        this.deleteItem = this.deleteItem.bind(this)
    }
    state = {  }
    render() { 
        console.log('child-render');
        
        return ( 
            <li
            dangerouslySetInnerHTML={{__html:this.props.avname+'为你做'+this.props.content}} 
            onClick={this.deleteItem}></li>
         );
    }
    deleteItem(){
        this.props.deleteItema(this.props.index)
    }
    componentWillReceiveProps(){
        console.log('componentWillReceiveProps');
    }
    componentWillUnmount(){
        console.log('componentWillUnmount');
    }
    shouldComponentUpdate(nextProps,nextState){
        if(nextProps.content !== this.props.Component){
            return true
        }else{
            return false;
        }
    }
}


Xiaojiejie.propTypes={
    content:PropTypes.string,
    deleteItema:PropTypes.func,
    index:PropTypes.number,
    avname:PropTypes.string.isRequired
}
Xiaojiejie.defaultProps = {
    avname:'松导枫'
}
export default Xiaojiejie;